<html>
<head><meta charset="utf-8"><title>insert mode exited request · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html">insert mode exited request</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="242219010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242219010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Manmeet Singh <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242219010">(Jun 10 2021 at 14:49)</a>:</h4>
<p>say I am in command mode.</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">X</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="cp">$</span><span class="mi">0</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>I enter insert mode and type <code>foo: i32</code> and exit insert mode</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">X</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">foo</span>: <span class="kt">i32</span><span class="cp">$</span><span class="mi">0</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>now I want rust analyzer to _somehow_ fix all uses of <code>X</code>. <br>
any suggestions how to implement this</p>



<a name="242219305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242219305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242219305">(Jun 10 2021 at 14:50)</a>:</h4>
<p>We have a feature where you use a structure field that doesn't exist, you get a diagnostic and a fix to add it to the struct definition</p>



<a name="242219553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242219553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242219553">(Jun 10 2021 at 14:52)</a>:</h4>
<p>But there's no way to add it to every usage of the struct</p>



<a name="242219688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242219688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Manmeet Singh <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242219688">(Jun 10 2021 at 14:53)</a>:</h4>
<p>another example will be with function arguments</p>



<a name="242219717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242219717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242219717">(Jun 10 2021 at 14:53)</a>:</h4>
<p>somewhat similar to <a href="https://github.com/rust-analyzer/rust-analyzer/issues/6499">6499</a></p>



<a name="242219847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242219847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242219847">(Jun 10 2021 at 14:54)</a>:</h4>
<p>but I don't know if one insert mode operation would be the right granularity for this</p>



<a name="242220114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242220114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Manmeet Singh <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242220114">(Jun 10 2021 at 14:56)</a>:</h4>
<p>I think it will good enough for most of cases. we can always have explicit start and end requests</p>



<a name="242220220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242220220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242220220">(Jun 10 2021 at 14:56)</a>:</h4>
<p>I'd like to experiment with  change signature "auto-refactor".</p>
<ul>
<li>firtst a code-action is used to initiate signature-change operation, by adding a comment duplicating the old signature</li>
<li>second, the user edits signature of the item</li>
<li>third, a second code-action looks a  the old signature in the comment, at the new signature in the code, and fixes up all the call-sites.</li>
</ul>



<a name="242220497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/insert%20mode%20exited%20request/near/242220497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Manmeet Singh <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/insert.20mode.20exited.20request.html#242220497">(Jun 10 2021 at 14:58)</a>:</h4>
<p>oh commenting is a good idea</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>